#pragma once

#include <zenoui/widgets/EmptyWidget.hpp>
#include <zenoui/Signal.hpp>

namespace zenoui {

struct GraphicsItemWidget : EmptyWidget { // a widget visualizing graphics scene with graphics item, just like QGraphicsView
protected:
    bool m_draggable = true;
    bool m_selectable = true;
    bool m_selected = false;

    friend struct GraphicsViewWidget;

    void handle(MouseClickEvent *event) override;
    void handle(MouseMoveEvent *event) override;
    void handle(MouseReleaseEvent *event) override;
    using EmptyWidget::handle;

public:
    void set_position(glm::vec2 const &pos);
    glm::vec2 const &position() const {
        return shape().position;
    }

    GraphicsItemWidget();
    ~GraphicsItemWidget();

    Signal<Widget> sig_updatePosition;
};

}
